/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package toesp.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author satria.sp
 */
@Entity
@Table(name = "groupuser")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Groupuser.findAll", query = "SELECT g FROM Groupuser g")})
public class Groupuser implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "groupuser_id")
    private Integer groupuserId;
    //--------------------------------------------------------------------------
    @Basic(optional = false)
    @Column(name = "group_id")
    private Integer groupId;
    @Basic(optional = false)
    @Column(name = "pengg_uid")
    private String penggUid;
    //--------------------------------------------------------------------------
    @JoinColumn(name = "group_id", referencedColumnName = "group_id", insertable = false, updatable = false)
    @ManyToOne
    private Grouppermission grouppermission;
    @JoinColumn(name = "pengg_uid", referencedColumnName = "pengg_uid", insertable = false, updatable = false)
    @ManyToOne
    private Pengguna pengguna;

    public Groupuser() {
    }

    public Groupuser(Integer groupuserId) {
        this.groupuserId = groupuserId;
    }

    public Integer getGroupuserId() {
        return groupuserId;
    }

    public void setGroupuserId(Integer groupuserId) {
        this.groupuserId = groupuserId;
    } 

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (groupuserId != null ? groupuserId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Groupuser other = (Groupuser) obj;
        if (this.groupId != other.groupId && (this.groupId == null || !this.groupId.equals(other.groupId))) {
            return false;
        }
        if ((this.penggUid == null) ? (other.penggUid != null) : !this.penggUid.equals(other.penggUid)) {
            return false;
        }
        return true;
    }

    /**
     * @return the groupId
     */
    public Integer getGroupId() {
        return groupId;
    }

    /**
     * @param groupId the groupId to set
     */
    public void setGroupId(Integer groupId) {
        this.groupId = groupId;
    }

    /**
     * @return the penggUid
     */
    public String getPenggUid() {
        return penggUid;
    }

    /**
     * @param penggUid the penggUid to set
     */
    public void setPenggUid(String penggUid) {
        this.penggUid = penggUid;
    }

    /**
     * @return the grouppermission
     */
    public Grouppermission getGrouppermission() {
        return grouppermission;
    }

    /**
     * @param grouppermission the grouppermission to set
     */
    public void setGrouppermission(Grouppermission grouppermission) {
        this.grouppermission = grouppermission;
    }

    /**
     * @return the pengguna
     */
    public Pengguna getPengguna() {
        return pengguna;
    }

    /**
     * @param pengguna the pengguna to set
     */
    public void setPengguna(Pengguna pengguna) {
        this.pengguna = pengguna;
    }
}
